<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page import="java.util.Map,java.util.Iterator,
org.openid4java.discovery.Discovery,
org.openid4java.message.*" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>OpenID HTML FORM Redirection</title>
</head>
<body onload="document.forms['openid-form-redirection'].submit();">
    <form name="openid-form-redirection" action="${message.OPEndpoint}" method="post" accept-charset="utf-8">
        <%-- 
        <c:forEach var="parameter" items="${message.parameterMap}">
        <input type="hidden" name="${parameter.key}" value="${parameter.value}"/>
        </c:forEach>
        --%>
        <%
        		AuthRequest authReq = (org.openid4java.message.AuthRequest)request.getAttribute("message");
                Map pm= authReq.getParameterMap();
                Iterator keyit=pm.keySet().iterator();
                Object key;
                Object value;
                Discovery disc = new Discovery();
                while (keyit.hasNext())
                {
                    key=keyit.next();
                    value=pm.get(key);
                    if ((AuthRequest.SELECT_ID.equals(value)) && ("openid.claimed_id".equals(key) || "openid.identity".equals(key))) {
                    	value = disc.parseIdentifier(request.getParameter("openid_identifier"));
                    }

        %>
        			<input type="hidden" name="<%= key%>" value="<%= value%>"/>
        <%
                }
        %>
        <button type="submit">Continue...</button>
    </form>
</body>
</html>
